home *** CD-ROM | disk | FTP | other *** search
/ Macwelt 1 / Macwelt DVD 1.toast / Web-Publishing / HTML-Editoren / Alpha ƒ / Mode Examples / SPSS-Example.sps < prev    next >
Encoding:
Text File  |  2000-10-30  |  9.3 KB  |  369 lines

  1. ** 
  2.  * ==========================================================================
  3.  * SPSS-Example.sps
  4.  * 
  5.  * Distributed as an example of Alpha's SPSS mode.
  6.  * 
  7.  * SPSS mode is available in the Statistical Modes package at
  8.  * 
  9.  * <ftp://ftp.ucsd.edu/pub/alpha/>
  10.  * ==========================================================================
  11.  **
  12.  
  13. ** 
  14.  * ==========================================================================
  15.  *  Correlates of War Analysis - Exploring global trends over two centuries
  16.  * 
  17.  *  FILE: "correlates-1-1.sps"
  18.  *                                    created: 12/01/99 {10:39:52 pm} 
  19.  *                                last update: 06/13/00 {03:51:17 pm} 
  20.  *  Description: 
  21.  *  
  22.  *  source file that creates a frequency file "correlates-1-1.freq"
  23.  *  for civil wars, performs minor recodes
  24.  *  
  25.  *  Author: Craig Barton Upright
  26.  *  E-mail: <cupright@princeton.edu>
  27.  *    mail: Princeton University, Department of Sociology
  28.  *          Princeton, New Jersey 08544
  29.  *     www: <http://www.princeton.edu/~cupright>
  30.  *  
  31.  *  ----------------------------------------------
  32.  * 
  33.  *  Copyright (c) 1999-2000 
  34.  *  
  35.  *  Craig Barton Upright,
  36.  *  Princeton University
  37.  *  
  38.  *  All rights reserved.
  39.  *  
  40.  * ==========================================================================
  41.  **
  42.  
  43.  
  44. *** Preliminaries
  45.  
  46. set width = 80.
  47.  
  48.  
  49. * Importing portable data files, running frequencies.
  50.  
  51. import file = "../data/sp9905cw.export".
  52.  
  53. display dictionary.
  54.  
  55. freq all.
  56.  
  57. execute.
  58.  
  59.  
  60. *** Creating new variables
  61.  
  62. compute yrbeg1 = yrbeg1 + 1000.
  63. compute yrbeg2 = yrbeg2 + 1000.
  64. compute yrbeg3 = yrbeg3 + 1000.
  65.  
  66. compute yrend1 = yrend1 + 1000.
  67. compute yrend2 = yrend2 + 1000.
  68. compute yrend3 = yrend3 + 1000.
  69.  
  70.  
  71. * here's how we could make sure that wars with
  72. * multiple stops / starts have the last ending year:
  73.  
  74. * compute yrend1 = yrend2 if (yrend2 > yrend1).
  75. * compute yrend1 = yrend3 if (yrend3 > yrend1).
  76.  
  77.  
  78. * creating civil / international dummies
  79.  
  80. compute civil = 1.
  81. compute intl  = 0.
  82.  
  83. formats civil    (F8.0).
  84. formats intl     (F8.0).
  85.  
  86. add value labels civil intl
  87.  
  88.     0 "international war     "
  89.     1 "civil war             ".
  90.  
  91.  
  92. * creating 19th, 20th century dummies
  93.  
  94. compute year = yrbeg1.
  95.  
  96. recode  year
  97.  
  98.     (1800 thru 1899 = 19)
  99.     (1900 thru 1999 = 20)
  100.  
  101.     into century.
  102.  
  103. recode  century
  104.  
  105.     (19 = 1) (20 = 0)
  106.  
  107.     into ninetnth.
  108.  
  109. recode  century
  110.  
  111.     (19 = 0) (20 = 1)
  112.  
  113.     into twntieth.
  114.  
  115. add value labels ninetnth twntieth
  116.  
  117.     0 "0 nineteenth century  "
  118.     1 "1 twentieth century   ".
  119.  
  120.  
  121. formats year     (F8.0).
  122. formats century  (F8.0).
  123. formats ninetnth (F8.0).
  124. formats twntieth (F8.0).
  125.  
  126.  
  127. * changing the case of the value labels in the variable warname.
  128.  
  129. compute warnumb = warnum.
  130.  
  131. recode  warnumb
  132.  
  133.     (601 = "Spain (1821-1823)"                                 )
  134.     (602 = "Two Sicilies (1820-1821) I "                       )
  135.     (603 = "Sardinia (1821) I "                                )
  136.     (604 = "Turkey/Ottoman Empire (1826)"                      )
  137.     (607 = "Portugal (1829-1834) I "                           )
  138.     (610 = "France (1830)"                                     )
  139.     (613 = "Mexico (1832)"                                     )
  140.     (616 = "Spain (1834-1840) I "                              )
  141.     (619 = "Colombia (1840-1842)"                              )
  142.     (622 = "Argentina (1841-1851) I "                          )
  143.     (625 = "Spain (1847-1849)"                                 )
  144.     (626 = "Mexico [Caste War] (1847-1855)"                    )
  145.     (628 = "Two Sicilies (1848-1849)"                          )
  146.     (631 = "France (1848)"                                     )
  147.     (634 = "Austria-Hungary (1848)"                            )
  148.     (636 = "France [Royalists] (1851)"                         )
  149.  
  150.     into warname.
  151.  
  152.  
  153. * creating wwI, wwII, worldwar dummy variables
  154.  
  155. recode  warnumb
  156.  
  157.     (106 = 1) (else = 0)
  158.  
  159.     into wwI.
  160.  
  161. recode  warnumb
  162.  
  163.     (139 = 1) (else = 0)
  164.  
  165.     into wwII.
  166.  
  167. recode  warnumb
  168.  
  169.     (106, 139 = 1) (else = 0)
  170.  
  171.     into worldwar.
  172.  
  173. formats wwI      (F8.0).
  174. formats wwII     (F8.0).
  175. formats worldwar (F8.0).
  176.  
  177. variable labels wwI      "World War One dummy variable   ".
  178. variable labels wwII     "World War Two dummy variable   ".
  179. variable labels worldwar "World War either dummy variable".
  180.  
  181.  
  182. *** Recoding countries into regions
  183.  
  184. recode ccode
  185.  
  186.     /* South America and Mexico */
  187.  
  188.     ( 70, 100, 101, 110, 115, 130, 135, 140, 
  189.      145, 150, 155, 160, 165,                = 1)
  190.  
  191.     /* Central America and Caribbean */
  192.  
  193.     ( 31,  40,  41,  42,  51,  52,  53,  54,
  194.       55,  56,  57,  58,  60,  80,  90,  91,  
  195.       92,  93,  94,  95,                     = 2)
  196.  
  197.     /* South America and Mexico */
  198.  
  199.     (  2,  20, 200, 205, 210, 211, 212, 220,
  200.      223, 225, 230, 235, 240, 245, 255, 260,
  201.      265, 267, 269, 271, 273, 275, 280, 290,
  202.      300, 305, 310, 315, 325, 327, 329, 331,
  203.      332, 335, 337, 338, 339, 344, 345, 346,
  204.      349, 350, 352, 355, 359, 360, 365, 366,
  205.      367, 368, 369, 370, 371, 372, 373, 375,
  206.      380, 385, 390, 395,                     = 3)
  207.  
  208.     /*  North America and Europe */
  209.  
  210.     (600, 615, 616, 620, 625, 630, 640, 645,
  211.      651, 652, 660, 663, 666, 670, 678, 679,
  212.      680, 690, 692, 694, 696, 698,           = 4)
  213.  
  214.     /*  Middle East / North Africa */
  215.  
  216.     (402, 403, 404, 411, 420, 432, 433, 434, 
  217.      435, 436, 437, 438, 439, 450, 451, 452, 
  218.      461, 471, 475, 481, 482, 483, 484, 490,
  219.      500, 501, 510, 511, 516, 517, 520, 522,
  220.      522, 530, 540, 541, 551, 552, 553, 560,
  221.      565, 570, 571, 572, 580, 581, 590, 591, = 5)
  222.  
  223.     /* Africa */
  224.  
  225.     (700, 701, 702, 703, 704, 705, 710, 712,
  226.      713, 730, 731, 732, 740, 750, 760, 770,
  227.      771, 775, 780, 781, 790, 800, 811, 812,
  228.      816, 817, 820, 830, 835, 840, 850, 900,
  229.      910, 920, 935, 940, 950, 983, 987,      = 6)
  230.  
  231.     into region.
  232.  
  233. add value labels region
  234.  
  235.     1 "1 South America and Mexico      "
  236.     2 "2 Central America and Caribbean "
  237.     3 "3 North America and Europe      "
  238.     4 "4 Middle East and North Africa  "
  239.     5 "5 Africa                        "
  240.     6 "6 Asia                          ".
  241.  
  242. string regname (A32).
  243.  
  244. recode region
  245.  
  246.     (1 = "South America and Mexico       ")
  247.     (2 = "Central America and Caribbean  ")
  248.     (3 = "North America and Europe       ")
  249.     (4 = "Middle East and North Africa   ")
  250.     (5 = "Africa                         ")
  251.     (6 = "Asia                           ")
  252.  
  253.     into regname.
  254.  
  255.  
  256. formats region   (F8.0).
  257.  
  258. variable labels region   "region name                    ".
  259.  
  260. execute.
  261.  
  262.  
  263. *** Renaming variables
  264. * note: even thought the codebook says that the name of the variable
  265. * for population is POP, it is actually TOTPOP.
  266. *
  267.  
  268. rename variables 
  269.  
  270.     (duration = durmnth  )
  271.     (battdea  = dead     )
  272.     (numarmy  = military )
  273.     (totpop   = populatn ).
  274.  
  275.  
  276. * note: 10 cases have durations of zero, which does not make sense.
  277. * I'm changing them to have at least a one-month duration.
  278.  
  279. recode  durmnth  (0 = 1).
  280.  
  281. * creating duration by year variable
  282.  
  283. compute duryear = durmnth / 12.
  284.  
  285.  
  286. * creating a second duryear variable that will only be attached to the
  287. * starting year of the war
  288.  
  289. compute duryear1 = duryear.
  290.  
  291.  
  292. * changing scale of population measures
  293.  
  294. compute  dead     = dead     * 1    .
  295. compute  military = military * 1000 .
  296. compute  populatn = populatn * 1000 .
  297.  
  298.  
  299. * creating a second population, military variable that will only be attached
  300. * to the starting year of the war
  301.  
  302. compute popnorig = populatn.
  303. compute miltary2 = military.
  304.  
  305. formats  populatn (F8.0).
  306. formats  popnorig (F8.0).
  307. formats  military (F8.0).
  308. formats  miltary2 (F8.0).
  309.  
  310. variable labels durmnth  "Duration of Involvement (months)".
  311. variable labels duryear  "Duration of Involvement (years) ".
  312. variable labels duryear1 "Duration of Involvement (years) ".
  313. variable labels dead     "Battle Related Fatalities Sustained (actual number)".
  314. variable labels military "Pre-war Regular Armed Forces (actual number)".
  315. variable labels miltary2 "Pre-war Regular Armed Forces (actual number)".
  316. variable labels populatn "Pre-war Total Population (actual number)".
  317. variable labels popnorig "Pre-war Total Population (actual number)".
  318.  
  319.  
  320. execute.
  321.  
  322.  
  323. *** Finishing up
  324.  
  325. * sorting cases
  326.  
  327. sort cases by region natname year warnumb.
  328.  
  329.  
  330. * saving, re-ordering variables
  331.  
  332. save   outfile = "../data/correlates-1-1.sav"
  333.  
  334.     /keep   year     region   regname  ccode    natname  abbrev
  335.             warnumb  warname  wwI      wwII     worldwar 
  336.             century  civil    ninetnth twntieth intl     
  337.             durmnth  duryear  duryear1 dead     military miltary2
  338.             populatn popnorig ALL                                    
  339.  
  340.     /drop   warnum
  341.             mobeg1   dybeg1    moend1   dyend1   
  342.             mobeg2   dybeg2    moend2   dyend2   
  343.             mobeg3   dybeg3    moend3   dyend3 
  344.             wartype  censyst   major    winner
  345.             western  europe    african  mideast
  346.             asian    oceanic   intersta interven  .
  347.  
  348. export outfile = "../data/correlates-1-1.por"
  349.  
  350.     /keep   year     region   regname  ccode    natname  abbrev
  351.             warnumb  warname  wwI      wwII     worldwar
  352.             century  civil    ninetnth twntieth intl
  353.             durmnth  duryear  duryear1 dead     military miltary2
  354.             populatn popnorig ALL 
  355.  
  356.     /drop   warnum
  357.             mobeg1   dybeg1    moend1   dyend1   
  358.             mobeg2   dybeg2    moend2   dyend2   
  359.             mobeg3   dybeg3    moend3   dyend3 
  360.             wartype  censyst   major    winner
  361.             western  europe    african  mideast
  362.             asian    oceanic   intersta interven  .
  363.  
  364.  
  365. execute.
  366.  
  367. * .
  368.